import { ConfigService } from '@nestjs/config';

/**
 * 应用配置接口
 */
export interface AppConfig {
  port: number;
  nodeEnv: string;
  jwtSecret: string;
  jwtExpiresIn: string;
}

/**
 * 获取应用配置
 * @param configService 配置服务
 * @returns 应用配置对象
 */
export const getAppConfig = (configService: ConfigService): AppConfig => ({
  port: parseInt(configService.get('PORT', '3000'), 10),
  nodeEnv: configService.get('NODE_ENV', 'development'),
  jwtSecret: configService.get('JWT_SECRET', 'default-secret'),
  jwtExpiresIn: configService.get('JWT_EXPIRES_IN', '7d'),
});